<!DOCTYPE html>
<html>
  <head>
  <meta charset='UTF-8'>
  <title>CamanJS Documentation</title>
  <link rel='stylesheet' href='../assets/codo.css' type='text/css'>
  <script src='../assets/codo.js'></script>
  <script src='../assets/search_data.js'></script>
</head>
  <body>
    <div id='base' data-path='../'></div>
<div id='header'>
  <div id='menu'>
    <a href='../README.md.html' title='CamanJS'>CamanJS</a>
    &raquo;
    <a href='../class_index.html' title='Index'>Index</a>
    &raquo;
    <span class='title'>Caman</span>
    <nav>
      <ul>
        <li class='noframes'>
          (<a class='noframes' href='#'>no frames</a>)
        </li>
      </ul>
    </nav>
    <div id='search'>
      <a id='class_list_link' href='../class_list.html'>Classes</a>
      <a id='file_list_link' href='../file_list.html'>Files</a>
      <a id='method_list_link' href='../method_list.html'>Methods</a>
      <a id='extra_list_link' href='../extra_list.html'>Extras</a>
    </div>
  </div>
  <iframe id='search_frame'></iframe>
  <div id='fuzzySearch'>
    <input type='text'>
    <ol></ol>
  </div>
  <div id='help'>
    <p>
      Quickly fuzzy find classes, mixins, methods, file:
    </p>
    <ul>
      <li>
        <span>Ctrl-T</span>
        Open fuzzy finder dialog
      </li>
    </ul>
    <p>
      In frame mode you can toggle the list naviation frame on the left side:
    </p>
    <ul>
      <li>
        <span>Ctrl-L</span>
        Toggle list view
      </li>
    </ul>
    <p>
      You can focus a list in frame mode or toggle a tab in frameless mode:
    </p>
    <ul>
      <li>
        <span>Ctrl-C</span>
        Class list
      </li>
      <li>
        <span>Ctrl-I</span>
        Mixin list
      </li>
      <li>
        <span>Ctrl-F</span>
        File list
      </li>
      <li>
        <span>Ctrl-M</span>
        Method list
      </li>
      <li>
        <span>Ctrl-E</span>
        Extras list
      </li>
    </ul>
    <p>
      You can focus and blur the search input:
    </p>
    <ul>
      <li>
        <span>Ctrl-S</span>
        Focus search input
      </li>
      <li>
        <span>Esc</span>
        Blur search input
      </li>
    </ul>
    <p>
      In frameless mode you can close the list tab:
    </p>
    <ul>
      <li>
        <span>Esc</span>
        Close list tab
      </li>
    </ul>
  </div>
</div>
    <div id='content'>
      <h1>
        Class:
        Caman
      </h1>
      <table class='box'>
        <tr>
          <td>Defined in:</td>
          <td>src&#47;core&#47;caman.coffee</td>
        </tr>
        <tr>
          <td>Inherits:</td>
          <td>
            <a href='../classes/Module.html'>Module</a>
          </td>
        </tr>
      </table>
      <h2>Overview</h2>
      <div class='docstring'>
  <p>Here it begins. Caman is defined.
There are many different initialization for Caman, which are described on the 
<a href="http://camanjs.com/guides">Guides</a>.</p><p>Initialization is tricky because we need to make sure everything we need is actually fully 
loaded in the DOM before proceeding. When initialized on an image, we need to make sure that the 
image is done loading before converting it to a canvas element and writing the pixel data. If we 
do this prematurely, the browser will throw a DOM Error, and chaos will ensue. In the event that 
we initialize Caman on a canvas element while specifying an image URL, we need to create a new 
image element, load the image, then continue with initialization.</p><p>The main goal for Caman was simplicity, so all of this is handled transparently to the end-user. </p>
</div>
<div class='tags'>
</div>
      <h2>Property Summary</h2>
      <dl class='properties'>
        <dt id='DEBUG-property'>
          <span class='signature'>
            (Boolean) <strong>DEBUG</strong>
          </span>
        </dt>
        <dd class='desc'>
          <p>Debug mode enables console logging.</p>
        </dd>
      </dl>
      <h2>Class Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='#toString-class'>
        + (String) <strong>toString</strong>()
      </a>
    </span>
    <span class='desc'>
      Custom toString()
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#getAttrId-class'>
        + (String) <strong>getAttrId</strong>(canvas)
      </a>
    </span>
    <span class='desc'>
      Get the ID assigned to this canvas by Caman.
    </span>
  </li>
</ul>
      <h2>Instance Method Summary</h2>
      <ul class='summary'>
  <li>
    <span class='signature'>
      <a href='#constructor-instance'>
        - (Caman) <strong>constructor</strong>()
      </a>
    </span>
    <span class='constructor note title'>Constructor</span>
    <span class='desc'>
      The Caman function.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#domIsLoaded-instance'>
        - (void) <strong>domIsLoaded</strong>(cb)
      </a>
    </span>
    <span class='desc'>
      Checks to ensure the DOM is loaded.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#parseArguments-instance'>
        - (void) <strong>parseArguments</strong>(args)
      </a>
    </span>
    <span class='desc'>
      Parses the arguments given to the Caman function, and sets the appropriate properties on this instance.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#setInitObject-instance'>
        - (void) <strong>setInitObject</strong>(obj)
      </a>
    </span>
    <span class='desc'>
      Sets the initialization object for this instance.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#setup-instance'>
        - (void) <strong>setup</strong>()
      </a>
    </span>
    <span class='desc'>
      Begins the setup process, which differs depending on whether we&#39;re in NodeJS, or if an image or canvas object was provided.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#initNode-instance'>
        - (void) <strong>initNode</strong>()
      </a>
    </span>
    <span class='desc'>
      Initialization function for NodeJS.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#readFromHttp-instance'>
        - (void) <strong>readFromHttp</strong>(url, callback)
      </a>
    </span>
    <span class='desc'>
      
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#nodeFileReady-instance'>
        - (void) <strong>nodeFileReady</strong>(err, data)
      </a>
    </span>
    <span class='bound note title'>Bound</span>
    <span class='desc'>
      
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#initImage-instance'>
        - (void) <strong>initImage</strong>()
      </a>
    </span>
    <span class='desc'>
      Initialization function for the browser and image objects.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#initCanvas-instance'>
        - (void) <strong>initCanvas</strong>()
      </a>
    </span>
    <span class='desc'>
      Initialization function for the browser and canvas objects.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#imageAdjustments-instance'>
        - (void) <strong>imageAdjustments</strong>()
      </a>
    </span>
    <span class='desc'>
      Automatically check for a HiDPI capable screen and swap out the image if possible.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#waitForImageLoaded-instance'>
        - (void) <strong>waitForImageLoaded</strong>()
      </a>
    </span>
    <span class='desc'>
      Utility function that fires <a href='../classes/Caman.html#imageLoaded-instance'>Caman#imageLoaded</a> once the image is finished loading.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#isImageLoaded-instance'>
        - (Boolean) <strong>isImageLoaded</strong>()
      </a>
    </span>
    <span class='desc'>
      Checks if the given image is finished loading.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#imageWidth-instance'>
        - (Number) <strong>imageWidth</strong>()
      </a>
    </span>
    <span class='desc'>
      Internet Explorer has issues figuring out image dimensions when they aren&#39;t explicitly defined, apparently.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#imageHeight-instance'>
        - (Number) <strong>imageHeight</strong>()
      </a>
    </span>
    <span class='desc'>
      
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#imageLoaded-instance'>
        - (void) <strong>imageLoaded</strong>()
      </a>
    </span>
    <span class='desc'>
      Function that is called once the initialization image is finished loading.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#finishInit-instance'>
        - (void) <strong>finishInit</strong>()
      </a>
    </span>
    <span class='desc'>
      Final step of initialization.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#reloadCanvasData-instance'>
        - (void) <strong>reloadCanvasData</strong>()
      </a>
    </span>
    <span class='desc'>
      If you have a separate context reference to this canvas outside of CamanJS and you make a change to the canvas outside of CamanJS, you will have to call this function to update our context reference to include those changes.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#resetOriginalPixelData-instance'>
        - (void) <strong>resetOriginalPixelData</strong>()
      </a>
    </span>
    <span class='desc'>
      Reset the canvas pixels to the original state at initialization.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hasId-instance'>
        - (Boolean) <strong>hasId</strong>()
      </a>
    </span>
    <span class='desc'>
      Does this instance have an ID assigned?
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#assignId-instance'>
        - (void) <strong>assignId</strong>()
      </a>
    </span>
    <span class='desc'>
      Assign a unique ID to this instance.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hiDPIDisabled-instance'>
        - (Boolean) <strong>hiDPIDisabled</strong>()
      </a>
    </span>
    <span class='desc'>
      Is HiDPI support disabled via the HTML data attribute?
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hiDPIAdjustments-instance'>
        - (void) <strong>hiDPIAdjustments</strong>()
      </a>
    </span>
    <span class='desc'>
      Perform HiDPI adjustments to the canvas.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hiDPIRatio-instance'>
        - (Number) <strong>hiDPIRatio</strong>()
      </a>
    </span>
    <span class='desc'>
      Calculate the HiDPI ratio of this display based on the backing store and the pixel ratio.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hiDPICapable-instance'>
        - (Boolean) <strong>hiDPICapable</strong>()
      </a>
    </span>
    <span class='desc'>
      Is this display HiDPI capable?
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#needsHiDPISwap-instance'>
        - (Boolean) <strong>needsHiDPISwap</strong>()
      </a>
    </span>
    <span class='desc'>
      Do we need to perform an image swap with a HiDPI image?
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#hiDPIReplacement-instance'>
        - (String) <strong>hiDPIReplacement</strong>()
      </a>
    </span>
    <span class='desc'>
      Gets the HiDPI replacement for the initialization image.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#replaceCanvas-instance'>
        - (void) <strong>replaceCanvas</strong>(newCanvas)
      </a>
    </span>
    <span class='desc'>
      Replaces the current canvas with a new one, and properly updates all of the applicable references for this instance.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#render-instance'>
        - (void) <strong>render</strong>(callback = function() {})
      </a>
    </span>
    <span class='desc'>
      Begins the rendering process.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#revert-instance'>
        - (void) <strong>revert</strong>(updateContext = true)
      </a>
    </span>
    <span class='desc'>
      Reverts the canvas back to it&#39;s original state while maintaining any cropped or resized dimensions.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#reset-instance'>
        - (void) <strong>reset</strong>()
      </a>
    </span>
    <span class='desc'>
      Completely resets the canvas back to it&#39;s original state.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#originalVisiblePixels-instance'>
        - (Array) <strong>originalVisiblePixels</strong>()
      </a>
    </span>
    <span class='desc'>
      Returns the original pixel data while maintaining any cropping or resizing that may have occured.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#process-instance'>
        - (Caman) <strong>process</strong>(name, processFn)
      </a>
    </span>
    <span class='desc'>
      Pushes the filter callback that modifies the RGBA object into the render queue.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#processKernel-instance'>
        - (Caman) <strong>processKernel</strong>(name, adjust, divisor = null, bias = 0)
      </a>
    </span>
    <span class='desc'>
      Pushes the kernel into the render queue.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#processPlugin-instance'>
        - (Caman) <strong>processPlugin</strong>(plugin, args)
      </a>
    </span>
    <span class='desc'>
      Adds a standalone plugin into the render queue.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#newLayer-instance'>
        - (Caman) <strong>newLayer</strong>(callback)
      </a>
    </span>
    <span class='desc'>
      Pushes a new layer operation into the render queue and calls the layer callback.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#executeLayer-instance'>
        - (void) <strong>executeLayer</strong>(layer)
      </a>
    </span>
    <span class='desc'>
      Pushes the layer context and moves to the next operation.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#pushContext-instance'>
        - (void) <strong>pushContext</strong>(layer)
      </a>
    </span>
    <span class='desc'>
      Set all of the relevant data to the new layer.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#popContext-instance'>
        - (void) <strong>popContext</strong>()
      </a>
    </span>
    <span class='desc'>
      Restore the previous layer context.
    </span>
  </li>
  <li>
    <span class='signature'>
      <a href='#applyCurrentLayer-instance'>
        - (void) <strong>applyCurrentLayer</strong>()
      </a>
    </span>
    <span class='desc'>
      Applies the current layer to its parent layer.
    </span>
  </li>
</ul>
      <h2>
        <small>Inherited Method Summary</small>
      </h2>
      <h3 class='inherited'>
        Methods inherited from
        <a href='../classes/Module.html'>Module</a>
      </h3>
      <p class='inherited'>
                <a href='../classes/Module.html#extends-class'>.extends</a>,
                <a href='../classes/Module.html#includes-class'>.includes</a>,
                <a href='../classes/Module.html#delegate-class'>.delegate</a>,
                <a href='../classes/Module.html#aliasFunction-class'>.aliasFunction</a>,
                <a href='../classes/Module.html#aliasProperty-class'>.aliasProperty</a>,
        <a href='../classes/Module.html#included-class'>.included</a>
      </p>
      <h2>Class Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='toString-class'>
      + (String) <strong>toString</strong>()
    </p>
    <div class='docstring'>
  <p>Custom toString()</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>Version and release information.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='getAttrId-class'>
      + (String) <strong>getAttrId</strong>(canvas)
    </p>
    <div class='docstring'>
  <p>Get the ID assigned to this canvas by Caman.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>canvas</span>
      <span class='type'>
        (<tt>DOMObject</tt>)
      </span>
      &mdash;
      <span class='desc'>The canvas to inspect.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>The Caman ID associated with this canvas.</span>
    </li>
  </ul>
</div>
  </div>
</div>
      <h2>Constructor Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='constructor-instance'>
      - (Caman) <strong>Caman</strong>(initializer)
      <br>
      - (Caman) <strong>Caman</strong>(initializer, callback)
      <br>
      - (Caman) <strong>Caman</strong>(initializer, url)
      <br>
      - (Caman) <strong>Caman</strong>(initializer, url, callback)
      <br>
      - (Caman) <strong>Caman</strong>(file)
      <br>
      - (Caman) <strong>Caman</strong>(file, callback)
      <br>
    </p>
    <div class='docstring'>
  <p>The Caman function. While technically a constructor, it was made to be called without
the <code>new</code> keyword. Caman will figure it out.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>initializer</span>
      <span class='type'>
        (<tt>DOMObject, String</tt>)
      </span>
      &mdash;
      <span class='desc'>The DOM selector or DOM object to initialize.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt><a href='../classes/Caman.html'>Caman</a></tt>)
      &mdash;
      <span class='desc'>Initialized Caman instance.</span>
    </li>
  </ul>
  <div class='overloads'>
    <h3>Overloads:</h3>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(initializer)
      </p>
      <div class='docstring'>
  <p>Initialize Caman without a callback.</p>
</div>
<div class='tags'>
</div>
    </div>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(initializer, callback)
      </p>
      <div class='docstring'>
  <p>Initialize Caman with a callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>callback</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>Function to call once initialization completes.</span>
    </li>
  </ul>
</div>
    </div>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(initializer, url)
      </p>
      <div class='docstring'>
  <p>Initialize Caman with a URL to an image and no callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>url</span>
      <span class='type'>
        (<tt>String</tt>)
      </span>
      &mdash;
      <span class='desc'>URl to an image to draw to the canvas.</span>
    </li>
  </ul>
</div>
    </div>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(initializer, url, callback)
      </p>
      <div class='docstring'>
  <p>Initialize Caman with a canvas, URL to an image, and a callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>url</span>
      <span class='type'>
        (<tt>String</tt>)
      </span>
      &mdash;
      <span class='desc'>URl to an image to draw to the canvas.</span>
    </li>
    <li>
      <span class='name'>callback</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>Function to call once initialization completes.</span>
    </li>
  </ul>
</div>
    </div>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(file)
      </p>
      <div class='docstring'>
  <p><strong>NodeJS</strong>: Initialize Caman with a path to an image file and no callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>file</span>
      <span class='type'>
        (<tt>String, File</tt>)
      </span>
      &mdash;
      <span class='desc'>File object or path to image to read.</span>
    </li>
  </ul>
</div>
    </div>
    <div class='overload'>
      <p class='signature'>
        - (Caman) <strong>Caman</strong>(file, callback)
      </p>
      <div class='docstring'>
  <p><strong>NodeJS</strong>: Initialize Caman with a file and a callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>file</span>
      <span class='type'>
        (<tt>String, File</tt>)
      </span>
      &mdash;
      <span class='desc'>File object or path to image to read.</span>
    </li>
    <li>
      <span class='name'>callback</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>Function to call once initialization completes.</span>
    </li>
  </ul>
</div>
    </div>
  </div>
</div>
  </div>
</div>
      <h2>Instance Method Details</h2>
      <div class='methods'>
  <div class='method_details'>
    <p class='signature' id='domIsLoaded-instance'>
      - (void) <strong>domIsLoaded</strong>(cb)
    </p>
    <div class='docstring'>
  <p>Checks to ensure the DOM is loaded. Ensures the callback is always fired, even
if the DOM is already loaded before it&#39;s invoked. The callback is also always
called asynchronously.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>cb</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>The callback function to fire when the DOM is ready.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='parseArguments-instance'>
      - (void) <strong>parseArguments</strong>(args)
    </p>
    <div class='docstring'>
  <p>Parses the arguments given to the Caman function, and sets the appropriate
properties on this instance.</p><p>@params [Array] args Array of arguments passed to Caman.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setInitObject-instance'>
      - (void) <strong>setInitObject</strong>(obj)
    </p>
    <div class='docstring'>
  <p>Sets the initialization object for this instance.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>obj</span>
      <span class='type'>
        (<tt>Object, String</tt>)
      </span>
      &mdash;
      <span class='desc'>The initialization argument.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='setup-instance'>
      - (void) <strong>setup</strong>()
    </p>
    <div class='docstring'>
  <p>Begins the setup process, which differs depending on whether we&#39;re in NodeJS,
or if an image or canvas object was provided.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='initNode-instance'>
      - (void) <strong>initNode</strong>()
    </p>
    <div class='docstring'>
  <p>Initialization function for NodeJS.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='readFromHttp-instance'>
      - (void) <strong>readFromHttp</strong>(url, callback)
    </p>
    <div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='nodeFileReady-instance'>
      - (void) <strong>nodeFileReady</strong>(err, data)
      (bound)
    </p>
    <div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='initImage-instance'>
      - (void) <strong>initImage</strong>()
    </p>
    <div class='docstring'>
  <p>Initialization function for the browser and image objects.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='initCanvas-instance'>
      - (void) <strong>initCanvas</strong>()
    </p>
    <div class='docstring'>
  <p>Initialization function for the browser and canvas objects.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='imageAdjustments-instance'>
      - (void) <strong>imageAdjustments</strong>()
    </p>
    <div class='docstring'>
  <p>Automatically check for a HiDPI capable screen and swap out the image if possible.
Also checks the image URL to see if it&#39;s a cross-domain request, and attempt to
proxy the image. If a cross-origin type is configured, the proxy will be ignored.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='waitForImageLoaded-instance'>
      - (void) <strong>waitForImageLoaded</strong>()
    </p>
    <div class='docstring'>
  <p>Utility function that fires <a href='../classes/Caman.html#imageLoaded-instance'>Caman#imageLoaded</a> once the image is finished loading.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='isImageLoaded-instance'>
      - (Boolean) <strong>isImageLoaded</strong>()
    </p>
    <div class='docstring'>
  <p>Checks if the given image is finished loading.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Is the image loaded?</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='imageWidth-instance'>
      - (Number) <strong>imageWidth</strong>()
    </p>
    <div class='docstring'>
  <p>Internet Explorer has issues figuring out image dimensions when they aren&#39;t
explicitly defined, apparently. We check the normal width/height properties first,
but fall back to natural sizes if they are 0.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Width of the initialization image.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='imageHeight-instance'>
      - (Number) <strong>imageHeight</strong>()
    </p>
    <div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>Height of the initialization image.</span>
    </li>
  </ul>
  <h3>See also:</h3>
  <ul class='see'>
    <li>
      <a href='../classes/Caman.html#imageWidth-instance'>Caman#imageWidth</a>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='imageLoaded-instance'>
      - (void) <strong>imageLoaded</strong>()
    </p>
    <div class='docstring'>
  <p>Function that is called once the initialization image is finished loading.
We make sure that the canvas dimensions are properly set here.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='finishInit-instance'>
      - (void) <strong>finishInit</strong>()
    </p>
    <div class='docstring'>
  <p>Final step of initialization. We finish setting up our canvas element, and we
draw the image to the canvas (if applicable).</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='reloadCanvasData-instance'>
      - (void) <strong>reloadCanvasData</strong>()
    </p>
    <div class='docstring'>
  <p>If you have a separate context reference to this canvas outside of CamanJS
and you make a change to the canvas outside of CamanJS, you will have to call
this function to update our context reference to include those changes.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='resetOriginalPixelData-instance'>
      - (void) <strong>resetOriginalPixelData</strong>()
    </p>
    <div class='docstring'>
  <p>Reset the canvas pixels to the original state at initialization.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hasId-instance'>
      - (Boolean) <strong>hasId</strong>()
    </p>
    <div class='docstring'>
  <p>Does this instance have an ID assigned?</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Boolean</tt>)
      &mdash;
      <span class='desc'>Existance of an ID.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='assignId-instance'>
      - (void) <strong>assignId</strong>()
    </p>
    <div class='docstring'>
  <p>Assign a unique ID to this instance.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hiDPIDisabled-instance'>
      - (Boolean) <strong>hiDPIDisabled</strong>()
    </p>
    <div class='docstring'>
  <p>Is HiDPI support disabled via the HTML data attribute?</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt>Boolean</tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hiDPIAdjustments-instance'>
      - (void) <strong>hiDPIAdjustments</strong>()
    </p>
    <div class='docstring'>
  <p>Perform HiDPI adjustments to the canvas. This consists of changing the
scaling and the dimensions to match that of the display.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hiDPIRatio-instance'>
      - (Number) <strong>hiDPIRatio</strong>()
    </p>
    <div class='docstring'>
  <p>Calculate the HiDPI ratio of this display based on the backing store
and the pixel ratio.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Number</tt>)
      &mdash;
      <span class='desc'>The HiDPI pixel ratio.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hiDPICapable-instance'>
      - (Boolean) <strong>hiDPICapable</strong>()
    </p>
    <div class='docstring'>
  <p>Is this display HiDPI capable?</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt>Boolean</tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='needsHiDPISwap-instance'>
      - (Boolean) <strong>needsHiDPISwap</strong>()
    </p>
    <div class='docstring'>
  <p>Do we need to perform an image swap with a HiDPI image?</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt>Boolean</tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='hiDPIReplacement-instance'>
      - (String) <strong>hiDPIReplacement</strong>()
    </p>
    <div class='docstring'>
  <p>Gets the HiDPI replacement for the initialization image.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>String</tt>)
      &mdash;
      <span class='desc'>URL to the HiDPI version.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='replaceCanvas-instance'>
      - (void) <strong>replaceCanvas</strong>(newCanvas)
    </p>
    <div class='docstring'>
  <p>Replaces the current canvas with a new one, and properly updates all of the
applicable references for this instance.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>newCanvas</span>
      <span class='type'>
        (<tt>DOMObject</tt>)
      </span>
      &mdash;
      <span class='desc'>The canvas to swap into this instance.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='render-instance'>
      - (void) <strong>render</strong>(callback = function() {})
    </p>
    <div class='docstring'>
  <p>Begins the rendering process. This will execute all of the filter functions
called either since initialization or the previous render.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>callback</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>Function to call when rendering is finished.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='revert-instance'>
      - (void) <strong>revert</strong>(updateContext = true)
    </p>
    <div class='docstring'>
  <p>Reverts the canvas back to it&#39;s original state while
maintaining any cropped or resized dimensions.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>updateContext</span>
      <span class='type'>
        (<tt>Boolean</tt>)
      </span>
      &mdash;
      <span class='desc'>Should we apply the reverted pixel data to the canvas context thus triggering a re-render by the browser?</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='reset-instance'>
      - (void) <strong>reset</strong>()
    </p>
    <div class='docstring'>
  <p>Completely resets the canvas back to it&#39;s original state.
Any size adjustments will also be reset.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='originalVisiblePixels-instance'>
      - (Array) <strong>originalVisiblePixels</strong>()
    </p>
    <div class='docstring'>
  <p>Returns the original pixel data while maintaining any
cropping or resizing that may have occured.
<strong>Warning</strong>: this is currently in beta status.</p>
</div>
<div class='tags'>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span>
      (<tt>Array</tt>)
      &mdash;
      <span class='desc'>Original pixel values still visible after cropping or resizing.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='process-instance'>
      - (Caman) <strong>process</strong>(name, processFn)
    </p>
    <div class='docstring'>
  <p>Pushes the filter callback that modifies the RGBA object into the
render queue.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>name</span>
      <span class='type'>
        (<tt>String</tt>)
      </span>
      &mdash;
      <span class='desc'>Name of the filter function.</span>
    </li>
    <li>
      <span class='name'>processFn</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>The Filter function.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt><a href='../classes/Caman.html'>Caman</a></tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='processKernel-instance'>
      - (Caman) <strong>processKernel</strong>(name, adjust, divisor = null, bias = 0)
    </p>
    <div class='docstring'>
  <p>Pushes the kernel into the render queue.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>name</span>
      <span class='type'>
        (<tt>String</tt>)
      </span>
      &mdash;
      <span class='desc'>The name of the kernel.</span>
    </li>
    <li>
      <span class='name'>adjust</span>
      <span class='type'>
        (<tt>Array</tt>)
      </span>
      &mdash;
      <span class='desc'>The convolution kernel represented as a 1D array.</span>
    </li>
    <li>
      <span class='name'>divisor</span>
      <span class='type'>
        (<tt>Number</tt>)
      </span>
      &mdash;
      <span class='desc'>The divisor for the convolution.</span>
    </li>
    <li>
      <span class='name'>bias</span>
      <span class='type'>
        (<tt>Number</tt>)
      </span>
      &mdash;
      <span class='desc'>The bias for the convolution.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt><a href='../classes/Caman.html'>Caman</a></tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='processPlugin-instance'>
      - (Caman) <strong>processPlugin</strong>(plugin, args)
    </p>
    <div class='docstring'>
  <p>Adds a standalone plugin into the render queue.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>plugin</span>
      <span class='type'>
        (<tt>String</tt>)
      </span>
      &mdash;
      <span class='desc'>Name of the plugin.</span>
    </li>
    <li>
      <span class='name'>args</span>
      <span class='type'>
        (<tt>Array</tt>)
      </span>
      &mdash;
      <span class='desc'>Array of arguments to pass to the plugin.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt><a href='../classes/Caman.html'>Caman</a></tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='newLayer-instance'>
      - (Caman) <strong>newLayer</strong>(callback)
    </p>
    <div class='docstring'>
  <p>Pushes a new layer operation into the render queue and calls the layer
callback.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>callback</span>
      <span class='type'>
        (<tt>Function</tt>)
      </span>
      &mdash;
      <span class='desc'>Function that is executed within the context of the layer. All filter and adjustment functions for the layer will be executed inside of this function.</span>
    </li>
  </ul>
  <h3>Returns:</h3>
  <ul class='return'>
    <li>
      <span class='type'></span><tt><a href='../classes/Caman.html'>Caman</a></tt></li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='executeLayer-instance'>
      - (void) <strong>executeLayer</strong>(layer)
    </p>
    <div class='docstring'>
  <p>Pushes the layer context and moves to the next operation.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>layer</span>
      <span class='type'>
        (<tt>Layer</tt>)
      </span>
      &mdash;
      <span class='desc'>The layer to execute.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='pushContext-instance'>
      - (void) <strong>pushContext</strong>(layer)
    </p>
    <div class='docstring'>
  <p>Set all of the relevant data to the new layer.</p>
</div>
<div class='tags'>
  <h3>Parameters:</h3>
  <ul class='param'>
    <li>
      <span class='name'>layer</span>
      <span class='type'>
        (<tt>Layer</tt>)
      </span>
      &mdash;
      <span class='desc'>The layer whose context we want to switch to.</span>
    </li>
  </ul>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='popContext-instance'>
      - (void) <strong>popContext</strong>()
    </p>
    <div class='docstring'>
  <p>Restore the previous layer context.</p>
</div>
<div class='tags'>
</div>
  </div>
  <div class='method_details'>
    <p class='signature' id='applyCurrentLayer-instance'>
      - (void) <strong>applyCurrentLayer</strong>()
    </p>
    <div class='docstring'>
  <p>Applies the current layer to its parent layer.</p>
</div>
<div class='tags'>
</div>
  </div>
</div>
    </div>
    <div id='footer'>
  Generated on
  Wed Nov 13 2013 09:33:09 GMT-0500 (EST)
  by
  <a href='https://github.com/netzpirat/codo' title='CoffeeScript API documentation generator'>Codo</a>
  v1.7.0
  (Node.js v0.10.21).
  &#10034;
  Press Ctrl-h to see the keyboard shortcuts
  &#10034;
  <a href='http://twitter.com/#!/netzpirat'>@netzpirat</a>
  &#10034;
  <a href='https://mksoft.ch'>mksoft.ch</a>
</div>
  </body>
</html>